/*
 * WantToBuyDetailOffer.java
 * business
 *
 * Created by chentao on 2017/5/12.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.data.OfferEntity;
import com.yidiandao.business.ui.widget.listview.ViewHolder;
import com.yidiandao.business.utils.ImageLoader;

/**
 * 发现-求购详情-报价信息
 * <p>
 * Created by ChenTao(chentao7v@gmail.com) on 2017/5/12 0012 16:00
 */
public class WantToBuyDetailOfferHolder extends ViewHolder {

    private ImageView ivAvatar;

    private TextView tvShopName;

    private TextView tvPhone;

    public TextView tvRepealOffer;

    @Override
    protected void initView(View rootView) {
        ivAvatar = (ImageView) rootView.findViewById(R.id.iv_avatar);
        tvShopName = (TextView) rootView.findViewById(R.id.tv_shop_name);
        tvPhone = (TextView) rootView.findViewById(R.id.tv_phone);
        tvRepealOffer = (TextView) rootView.findViewById(R.id.tv_repeal_offer);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_want_to_buy_detail_offer;
    }

    public void refreshUI(OfferEntity entity) {
        ImageLoader.loadAvatar(mContext, ivAvatar, entity.getSex());
        tvShopName.setText(entity.getDpName());
        tvPhone.setText(entity.getMobile());
        tvRepealOffer.setVisibility((entity.getCanCancel() == 1) ? View.VISIBLE : View.GONE);
    }
}
